#include "widget.h"
#include "./ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::paintEvent(QPaintEvent *event)
{
    qDebug() << "paintEvent";
    QPainter painter(this); // 画家

    painter.setPen(Qt::red); // 画笔
    painter.setBrush(Qt::yellow); // 画刷

    painter.drawLine(0, 0, 100, 100);
    painter.drawRect(100, 100, 100, 100);
    painter.drawText(20, 50, QString("文字"));
}
